/**
 * @Description: 扩展安装统一入口
 * @author 刘贵
 * @date 2020/11/16
 */

// 安装ui
import Vant from './ui/vant'

// 通用辅助工具
import commonUtils from '@/utils'

// 一些固定求情api
import api from '@/api'

// 请求函数
import { request, post, get, put, del, abortRequest } from '@/xhr/service.js'

// 加载vuex
import store from '@/store/index'

// 界面交互
import { showToast, hideToast, showLoading, hideLoading } from '@/utils/ec/interaction.js'

if (process.env.NODE_ENV !== 'production') {
  require('@/mock')
}

export default {
  install (Vue) {
    for (let k in commonUtils) {
      Vue.prototype[k] = commonUtils[k]
    }
    Vue.prototype.$configs = window.servers

    Vue.prototype.$api = api
    Vue.prototype.$store = store

    Vue.prototype.$request = request
    Vue.prototype.$post = post
    Vue.prototype.$get = get
    Vue.prototype.$put = put
    Vue.prototype.$del = del
    Vue.prototype.$abortRequest = abortRequest

    Vue.prototype.$showToast = showToast
    Vue.prototype.$hideToast = hideToast
    Vue.prototype.$showLoading = showLoading
    Vue.prototype.$hideLoading = hideLoading

    Vue.use(Vant)
  }
}
// use for vue
